import React from 'react'
import { SearchBar, Space } from 'antd-mobile'
import '@/assets/scss/header.css'
import { useHistory } from 'react-router-dom/cjs/react-router-dom'

export default function Header() {
  const his = useHistory()
  const style = {
    width:'100%',
    display:'flex',
    alignItems:"center",
    height:'54px',
    background:'red',
  }
  return (
    <div style={style}>
      {/* space --- 可以横着排列 */}

        <span className='address'>地址</span>
        <SearchBar placeholder='请输入内容' className='search'/>
        <span className='login' onClick={()=>{
           if(localStorage.getItem('token')){
            his.push('/mine')
           }else{
            his.push('/login')
           }
        }}>{localStorage.getItem('token') ? '我的':'登录'}</span>

    </div>
  )
}
